<%@ page import="com.zhangmengyuan.medical.entity.Goods" %>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/back.css" />
<script type="text/javascript">
function chagngClass(classId){
	document.getElementById("itemId").length = 1;
	<c:forEach items="${list}" var="itemBean">
		if (${itemBean.parentId} == classId){
			var option = new Option("${itemBean.itemName}","${itemBean.itemId}");
			document.getElementById("itemId").add(option);
		}
	</c:forEach>
}

function mod(){
	
		document.getElementById("oldPicPath").value="";
}
</script>
<%Goods goods = (Goods)request.getAttribute("goods"); %>
<form action="${pageContext.request.contextPath}/GoodsServlet?service=modifyGoods" method="post" enctype="multipart/form-data" name="form1"  onsubmit="return CheckForm();">
	<table align="center" width="600px" border="1" cellspacing="0" bordercolordark="#FFFFFF" bordercolorlight="#0066cc" style="font-size: 9pt;">
		<tr>
			<td>
				<table align="center">
					<tr>
						<td height="40px;">请选择商品的品牌：
						</td>
						<td>
							<select id="classId" name="classId" onchange="chagngClass(this.value);">
								<option value="">
												====请选择类别====
								</option>
								<c:forEach items="${biglist}" var="classBean">
									<option value="${class.classId}"
										<c:if test="${goods.goodsType==class.classId}">
											selected="selected"</c:if>>${classBean.className}</option>
								</c:forEach>
							</select><span style="color: red;">*</span>			
						</td>
					</tr>
					<tr>
						<td height="40px;">请选择商品的类别：
						</td>
						<td>
							<select id="itemId" name="itemId">
								<option value="">
												====请选择类别====
								</option>
								<c:forEach items="${list}" var="item">
									<option value="${item.itemId}"
										<c:if test="${goods.smallType==item.itemId}">selected="selected"</c:if>>${item.itemName}</option>
								</c:forEach>
							</select><span style="color: red;">*</span>
						</td>
					</tr>
					<tr>
						<td height="40px;">
							请输入商品的名称：
						</td>
						<td>
							<input type="text" id="goodsName" name="goodsName" value="${goods.goodsName}" readonly="readonly" placeholder="此项无法修改"><span style="color: red;">此项无法修改</span>
							<input type="hidden" name="goodsId" value="${goods.goodsId}">
						</td>
					</tr>
					<tr>
						<td>
							请选择商品状态：
						</td>
						<td>
							<select name="state">
								<option value="1" <c:if test="${goods.state==1}">selected="selected"</c:if>>上架</option>
								<option value="2" <c:if test="${goods.state==2}">selected="selected"</c:if>>下架</option>
							</select>
						</td>
					</tr>
					<tr>
						<td>
							请选择商品热销度：
						</td>
						<td>
							<select name="rmp">
								<%for(int i=0;i<11;i++){
									%>
										<option value="<%=i%>" <%=goods.getRmp()==i?"selected='selected'":"" %>><%=i%></option>									
									<%
								} %>
							</select>
						</td>
					</tr>
					<tr>
						<td height="40px;">请输入商品的价格：
						</td>
						<td>
							<input type="text" id="price" name="price" value="${goods.price}"><span style="color: red;">*</span>
						</td>
					</tr>
					<tr>
						<td height="40px;">请输入商品的数量：
						</td>
						<td>
							<input type="text" id="num" name="num" value="${goods.num}"><span style="color: red;">*</span>
						</td>
					</tr>
					<tr>
						<td height="60px;">
							<span>请输入对商品的描述：</span>
						</td>
						<td>
							<textarea rows="4" id="direction" name="direction" >${goods.direction}</textarea><span style="color: red;">*</span>
						</td>
					</tr>
					<tr>
						<td height="40px;">
							请选择商品的图片：
						</td>
						<td>
							<input type="file" id="picPath" name="newPicPath" onchange="mod();">
							<input type="hidden" id="oldPicPath" name="oldPicPath" value="${goods.picPath}">
						</td>
					</tr>
					<tr align="center">
						<td height="40px;">
							<input type="submit" value="提交">
						</td>
						<td>
							<input type="reset" value="重置">
						</td>
					</tr>
			</table>
			</td>
		<tr>
	</table>
</form>